package yr.website


class LoginInterceptor {

    LoginInterceptor() {
        match(controller: "menu").excludes(action: "solutioncard")
                .excludes(action: "solutionmedical")
                .excludes(action: "solutioncredit")
                .excludes(action: "solutionlife")
                .excludes(action: "jiaxing")
                .excludes(action: "jiangyin")
                .excludes(action: "zhoushan")
        match(controller: "user").excludes(action: "getCode")
                .excludes(action: "checkCode")
                .excludes(action: "index")
                .excludes(action: "solution")
                .excludes(action: "about")
                .excludes(action: "join")
                .excludes(action: "add")
        match(controller: "roles")
        match(controller: "apply").excludes(action: "add")
        match(controller: "jobb").excludes(action: "add")
                .excludes(action: "getAll")
        match(controller: "manager").excludes(action: "loginout")
                .excludes(action: "vali")
    }

    boolean before() {
        if (session.manager == null) {
            redirect(url: '/YR')
            return false
        } else {
            session.setMaxInactiveInterval(30 * 60)
            return true
        }
    }

    boolean after() { true }
}
